import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score

# 1. 读取数据
data = pd.read_csv('bilibili_videos.csv.csv')

# 2. 数据预处理
# 假设数据集中包含了'点赞数'、'播放量'、'互动热度'等特征列，以及'是否进入热搜榜前十'的标签列
X = data[['点赞数', '播放量', '投币数','评论数']]
y = data['是否进入热搜榜前十']

# 3. 数据集划分
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# 4. 模型训练
model = RandomForestClassifier()
model.fit(X_train, y_train)

# 5. 模型预测
y_pred = model.predict(X_test)

# 6. 模型评估
accuracy = accuracy_score(y_test, y_pred)
print("模型准确率：", accuracy)
